﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data.SqlClient;

namespace XEvents.Library
{
    internal struct dm_xe_package
    {
        internal string name;
        internal Guid guid;
        internal string description;
        internal int capabilities;
        internal string capabilities_desc;
        internal Guid module_guid;
        //internal byte[] module_address;

        internal dm_xe_package(SqlDataReader dr)
        {
            name = (dr["name"] == DBNull.Value ? string.Empty : dr["name"]).ToString();
            Utilities.IsGuid((dr["guid"] == DBNull.Value ? string.Empty : dr["guid"]).ToString(), out guid);
            description = (dr["description"] == DBNull.Value ? string.Empty : dr["description"]).ToString();
            Int32.TryParse((dr["capabilities"] == DBNull.Value ? "-1" : dr["capabilities"]).ToString(), out capabilities);
            capabilities_desc = (dr["capabilities_desc"] == DBNull.Value ? string.Empty : dr["capabilities_desc"]).ToString();
            Utilities.IsGuid((dr["module_guid"] == DBNull.Value ? string.Empty : dr["module_guid"]).ToString(), out module_guid);
            //module_address = dr.GetSqlBytes(6).Buffer;
        }
    }
}
